package com.sz.jinzheng.controller;

import com.sz.jinzheng.model.Result;
import com.sz.jinzheng.until.PmsUploadUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;


/**
 * @Description: UploadController
 * @author: Sheep
 * @date: 2021年07月12日 10:26
 */
@Slf4j
@RestController
@RequestMapping("/user")
public class UploadController {
    @PostMapping("/upload")
    public Result fileUpload(MultipartFile file){
            log.info(file.getOriginalFilename());
            log.info("来了");
            String url = PmsUploadUtil.uploadImage(file);
        if (url!=null){
            log.info("url"+url);
            return new Result(200,"上传成功",url);
        }
       return new Result(400,"上传失败",null);
    }
}
